<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.hz.model.User"%>
<%@page import="com.hz.util.ParamUtil"%>
<%@page import="com.hz.control.UserControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
            request.setCharacterEncoding("utf-8");
            User user = new User();
            String username = ParamUtil.getString(request,"username");
            String pwd = ParamUtil.getString(request,"password1");
            user.setUsername(ParamUtil.getString(request,"username"));
            user.setPassword(ParamUtil.getString(request,"password1"));
            user.setStuNum(ParamUtil.getString(request,"stuNum"));
            user.setRealname(ParamUtil.getString(request,"realName"));
            user.setSex(ParamUtil.getInt(request,"sex"));
            user.setTel(ParamUtil.getString(request,"tel"));
            user.setQq(ParamUtil.getString(request,"qq"));
            user.setEmail(ParamUtil.getString(request,"email","无"));
            user.setStuLevel(ParamUtil.getInt(request,"stuLevel"));
            user.setDepartmentId(ParamUtil.getInt(request,"departmentId"));
            user.setMajorId(ParamUtil.getInt(request,"majorId"));
            user.setGrade(ParamUtil.getInt(request,"grade"));
            user.setBirthday(ParamUtil.getString(request,"birthday","不详"));
            user.setBirthPlace(ParamUtil.getString(request,"birthPlace"));
            user.setHobby(ParamUtil.getString(request,"hobby"));
            user.setAward(ParamUtil.getString(request,"award","无"));
            user.setVolunteerExp(ParamUtil.getString(request,"volunteerExp","无"));
            user.setVolunteerNo("暂无");
            user.setIdCard(ParamUtil.getString(request,"idCard"));
            user.setRole(ParamUtil.getInt(request,"role",0));
           // user.setPicPath(request.getParameter("picPath"));
            System.out.println(user.getHobby());
            if(UserControl.insertUser(user)){
              //session.removeAttribute("picUrl");
             // response.sendRedirect("../login/login_do.jsp")
            %>
            <script>
            alert("注册 成功");
            //window.top.location="../login/login_do.jsp?username=<%=username%>&&password=<%=pwd%>";
            window.top.location="../../volunteer/pages/login.html";
            </script>
            
            <%}else{%>
             <script>
            alert("注册 失败");
            history.go(-1);
            </script>
            <%
            
            }
 %>
</body>
</html>